home *** CD-ROM | disk | FTP | other *** search
- // GETINFO SCRIPTING
- // Imports hungarian titles and description from port.hu site
-
- (***************************************************
- * Imports hungarian titles and description from: *
- * www.port.hu *
- * *
- * (c) 2002 Andor Szathmßri szaki@levele.hu *
- * www.szathmari.hu *
- * *
- * For use with Ant Movie Catalog 3.4.0 *
- * www.antp.be/software/moviecatalog *
- * *
- * This program is free software; you can *
- * redistribute it and/or modify it under the *
- * terms of the GNU General Public License as *
- * published by the Free Software Foundation; *
- * either version 2 of the License, or (at your *
- * option) any later version. *
- ***************************************************)
- program IMDb;
-
- var
- MovieName: string;
- BeginPos, EndPos: Integer;
-
- function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
- var
- i: Integer;
- begin
- result := -1;
- if StartAt < 0 then
- StartAt := 0;
- for i := StartAt to List.Count-1 do
- if Pos(Pattern, List.GetString(i)) <> 0 then
- begin
- result := i;
- Break;
- end;
- end;
-
- procedure AnalyzePage(Address: string);
- var
- Page: TStringList;
- LineNr: Integer;
- begin
- Page := TStringList.Create;
- Page.Text := GetPage(Address);
- if pos('Nincs ilyen cφm√ film.', Page.Text) = 0 then
- begin
- AnalyzeMoviePage(Page)
- end else showmessage('Nincs ilyen cφm√ film.')
- Page.Free;
- end;
-
- procedure AnalyzeMoviePage(Page: TStringList);
- var
- Line, Temp, Value, Value2, FullValue: string;
- LineNr: Integer;
- BeginPos, EndPos: Integer;
- begin
-
- //hungarian title
- LineNr := FindLine('/pls/ci/cinema.index_htm?', Page, 0);
- if LineNr > -1 then
- begin
- Line := Page.GetString(LineNr);
- BeginPos := pos('<strong>', Line)+8;
- EndPos := pos('</strong>', Line);
- Value := copy(Line, BeginPos, EndPos - BeginPos);
- SetField(fieldTranslatedTitle, Value);
- end;
-
- // Hungarian Genre
- LineNr := FindLine('/pls/ci/cinema.index_htm?', Page, 0);
- if LineNr > -1 then
- begin
- Line := Page.GetString(LineNr);
- BeginPos := pos('size="2"> (', Line)+11;
- EndPos := pos(') </font>', Line);
- Temp := copy(Line, BeginPos, EndPos - BeginPos);
- BeginPos := 0;
- EndPos := pos(', ', Temp)-1;
- Value := copy(Temp, BeginPos, EndPos - BeginPos);
- SetField(fieldCategory, Value);
- end;
-
- // Hungarian Description
- LineNr := FindLine('<FONT FACE="Tahoma, Arial CE, Arial" SIZE="1">', Page, 0);
- if LineNr > -1 then
- begin
- Line := Page.GetString(LineNr+1);
- Value := copy(Line, 0, 1024);
- if pos('Amennyiben', Line) = 0 then
- SetField(fieldDescription, Value);
-
- end;
- DisplayResults;
- end;
-
- begin
- if CheckVersion(3,4,0) then
- begin
- MovieName := GetField(fieldOriginalTitle);
- if MovieName = '' then
- MovieName := GetField(fieldTranslatedTitle);
- if Input('Port.hu Import', 'Enter the title of the movie:', MovieName) then
- begin
- //imdb title filter (, The; , A)
- EndPos := pos(', The', MovieName);
- if EndPos = 0 then EndPos := pos(', A', MovieName);
- if EndPos > 0 then MovieName := copy(MovieName, 0, EndPos-1);
- AnalyzePage('http://www.port.hu/pls/ci/cinema.film_list?i_film_title='+UrlEncode(MovieName));
- end;
- end else
- ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
- end.
-
-